/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.co.dupenois.geometry;

/**
 *
 * @author mpd209
 */
public class Triangle {

    private Line a;
    private Line b;
    private Line c;

    public Triangle(Line a, Line b, Line c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public double getArea() {
        double length_a = this.a.length();
        double length_b = this.b.length();
        //a is our base, we want height
        //need angle between a and b
        double angle = this.a.getAngleTo(b);
        //sin angle * hyp = opp
        //b is hyp and height is opp
        double height = Math.sin(angle)*length_b;
        return (length_a*height)/2;
    }

    /**
     * @return the a
     */
    public Line getA() {
        return a;
    }

    /**
     * @return the b
     */
    public Line getB() {
        return b;
    }

    /**
     * @return the c
     */
    public Line getC() {
        return c;
    }

    public Shape getShape(){
        Shape shape = new Shape();
        shape.addLine(a);
        shape.addLine(b);
        shape.addLine(c);
        return shape;
    }

}
